package com.codedef.diaryserver.repository;

import com.codedef.diaryserver.domain.DiaryDao;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface DiaryRepository extends JpaRepository<DiaryDao, Integer> {

    @Query(value = "select * from diary where user_id = ?1 order by date_time DESC", nativeQuery = true)
    List<DiaryDao> findAllByUserId(Integer userId);

}
